import request from '@/utils/request'
import { downFile } from '@/utils/request'

/**
 * 角色分页查询
 * @param {查询条件} data
 */
export function getRolePageList(data) {
  return request({
    url: 'baseFrame/role/pageList',
    method: 'post',
    data: data,
  })
}




/**
 * 新增角色
 * @param data
 */
export function addRole(data) {
  return request({
    url: 'baseFrame/role/add',
    method: 'post',
    data: data,
  })
}

/**
 * 修改角色
 * @param data
 */
export function modifyRole(data) {
  return request({
    url: 'baseFrame/role/modify',
    method: 'post',
    data: data,
  })
}

export function changeRoleState(data) {
    return request({
        url: 'baseFrame/role/changeState',
        method: 'post',
        data: data,
    })
}


/**
 * 获取角色详情
 * @param {Id}
 */
export function getRoleDetail(id) {
  return request({
    url: 'baseFrame/role/detail/' + id,
    method: 'get'
  })
}

/**
 * 删除角色
 * @param {主键} pid
 */
export function delRole(data) {
  return request({
    url: 'baseFrame/role/delete',
    method: 'post',
    data:data
  })
}

// 导出角色列表
export async function exportRoleList(query) {
  await downFile('baseFrame/role/exportList', { ...query })
}
